package com.example.server.service.Impl;

import com.example.server.dao.ComplaintMapper;
import com.example.server.dao.ComplaintUsersMapper;
import com.example.server.service.ComplaintUsersService;
import com.example.server.vo.ComplaintUsersVo;
import com.example.server.vo.ComplaintVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ComplaintUsersServiceImpl implements ComplaintUsersService{
    @Autowired
    ComplaintUsersMapper complaintUsersMapper;
    @Autowired
    ComplaintMapper complaintMapper;
    /**
     * 投诉信息全查
     */
    @Override
    public List<ComplaintUsersVo> getComplaintUsers() {
        return complaintUsersMapper.getComplaintUsers();
    }
    /**
     * 投诉信息增改
     */
    @Override
    public int saveOrUpdateComplaint(ComplaintVo complaintVo) {
        int i = 0;
        if(complaintVo.getId() == 0){
            complaintVo.setCreationTime(new Date());
            i = complaintMapper.addComplaint(complaintVo);
        }
        return i;
    }
}
